package com.xszx.entity.dto.goods;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xszx.common.PageRequest;

import java.io.Serializable;
import java.util.Objects;

/**
 * 封装货物信息的查询参数请求
 * 需要继承公共包中的 PageRequest 来支持分页查询
 */
public class GoodsQuerRequest extends PageRequest implements Serializable {

    /**
     * 货物id
     */
    private Integer gid;

    /**
     * 货物名称
     */
    private String name;

    /**
     * 货物类型
     */
    private String type;

    /**
     * 货物批次
     */
    private String code;

    /**
     * 货物状态
     */
    private String state;

    /**
     * 区域编号
     */
    @JsonProperty("rCode")
    private String rCode;

    public GoodsQuerRequest() {
    }

    public GoodsQuerRequest(Integer gid, String name, String type, String code, String state, String rCode) {
        this.gid = gid;
        this.name = name;
        this.type = type;
        this.code = code;
        this.state = state;
        this.rCode = rCode;
    }

    public String getrCode() {
        return rCode;
    }

    public void setrCode(String rCode) {
        this.rCode = rCode;
    }

    public Integer getGid() {
        return gid;
    }

    public void setGid(Integer gid) {
        this.gid = gid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getRCode() {
        return rCode;
    }

    @Override
    public String toString() {
        return "GoodsQuerRequest{" +
                "gid=" + gid +
                ", name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", code='" + code + '\'' +
                ", state='" + state + '\'' +
                ", rCode='" + rCode + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        GoodsQuerRequest that = (GoodsQuerRequest) o;
        return Objects.equals(gid, that.gid) && Objects.equals(name, that.name) && Objects.equals(type, that.type) && Objects.equals(code, that.code) && Objects.equals(state, that.state) && Objects.equals(rCode, that.rCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), gid, name, type, code, state, rCode);
    }

    private static final long serialVersionUID = 1L;
}
